<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%> 
<%@ page import="cn.ac.cintcm.dataconverge.researcher.domain.Organization,com.hs.core.page.PageUtil,com.hs.core.utils.*"%>
<%@ page import="cn.ac.cintcm.dataconverge.util.*"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";

PageUtil pageUtil = (PageUtil)request.getAttribute("pageUtil");
String pageStr = ""; 
int perpageCount = 1;
int currentPage = 1;
List list = null;
if(null != pageUtil){
   list = pageUtil.getPageList();
   pageStr = pageUtil.getPageStr();
   perpageCount = pageUtil.getNumberPerPage();
   currentPage = pageUtil.getCurrentPage();
} 
String orderName = (String)request.getAttribute("orderName");
String orderNum = (String)request.getAttribute("orderNum"); 
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
  	<TITLE>WordSparrow</TITLE>
  	 <link href="<%=basePath%>index/Themes/com/style.css" rel="stylesheet" type="text/css" />
    <script src="<%=basePath%>index/Scripts/Script.js" language="javascript" type="text/javascript"></script>
<script src="<%=basePath%>js/common.js" language="javascript" type="text/javascript"></script>
	<script src='<%=basePath%>dwr/engine.js'></script>
     <script src='<%=basePath%>dwr/util.js'></script> 
     <script src='<%=basePath%>dwr/interface/checkDelD.js'></script> 
     
	<SCRIPT type="text/javascript">
	function modifyUser(value) {
	        //var bln = window.confirm("确定要修改吗？", "确定", "取消");
	        //if(bln == true) {
//        var page=document.all.ec_p.value;
  			var page = 5;
			url = "organization.htm?action=tomodify&flag=mod&id=" + value+"&page="+page;
			openwindow(url,'800','500','');
			//}
		}
	
	function changeState(value) {
	var bln = window.confirm("确定要删除此单位及其相关部门吗？", "确定", "取消");
		if(bln == true) {
 			checkDelD.checkDelO(value,CallBackSearchO) 
		}
	}
	function CallBackSearchO(dataStr){  
     var a=eval(dataStr);  
     if(a[0].result==false)
     	alert(a[0].message);
     else{
      // var page=document.all.ec_p.value;
		   var page = 5;
			url = "organization.htm?action=delete&id=" + a[0].id+"&page="+page;
			//submitPageForm();
			document.location.href = url;
     }
 } 
	</SCRIPT>
</head>
  
  <body  scroll="yes">
  <div class="r_rtm_tb_mg1">
        <div class="r_rtm_tb1">
            <img src="<%=basePath%>index/Themes/com/idt_tb_pass.gif" />&nbsp;单位管理 
        </div>
    </div>
   <table cellspacing="2" cellpadding="0" width="100%" class="idt_item_mg" id="Table2">
     <tbody><form name ="searchform" action="organization.htm?action=list" method="post">
        <tr>
		<td class="fim_l">单位名称:</td>
            <td class="fim_r">
                <input type="text" class="com_textbox" id="name" name="name" value="<%=StringUtilTool.setObjNULLStr(request.getAttribute("name")) %>"></td>
         <td class="fim_l">单位地址:</td>
            <td class="fim_r">
               <input type="text" class="com_textbox" id="address" name="address" value="<%=StringUtilTool.setObjNULLStr(request.getAttribute("address")) %>"></td>
           <td class="fim_l">单位传真:</td>
            <td class="fim_r">
               <input type="text" class="com_textbox" id="fax" name="fax" value="<%=StringUtilTool.setObjNULLStr(request.getAttribute("fax")) %>"></td>
            <td class="fim_r" align="right" colspan="2">
                <input type="submit" value="查询" name="B3" class="com_btn2" id="Button5">
                 
                <input type="button" value="添加" name="B4" class="com_btn2" id="Button2" onclick="javascript:openwindow('organization.htm?action=tomodify&flag=add','800','500','');">
			 
            </td>
        </tr></form></tbody>
    </table>
<div class="content">
        <table width="*" cellpadding="0" cellspacing="1" class="dg_borderstyle" id="Table4" >
            <tr>
                <td class="dg_headerstyle">
                    序号</td>
                <td class="dg_headerstyle" >
                  <a href="javaScript:orderPage('name','<%=OrderTool.getOrderNum("name",orderName,orderNum)%>');">单位名称&nbsp;&nbsp;<%=OrderTool.getOrderImage(basePath,OrderTool.getOrderNum("name",orderName,orderNum))%></a></td>
                   
                    
                    <td class="dg_headerstyle">
                    <a href="javaScript:orderPage('unitcode','<%=OrderTool.getOrderNum("unitcode",orderName,orderNum)%>');">组织代码&nbsp;&nbsp;<%=OrderTool.getOrderImage(basePath,OrderTool.getOrderNum("unitcode",orderName,orderNum))%></a></td>
                <td class="dg_headerstyle">
                    <a href="javaScript:orderPage('website','<%=OrderTool.getOrderNum("website",orderName,orderNum)%>');">单位网址&nbsp;&nbsp;<%=OrderTool.getOrderImage(basePath,OrderTool.getOrderNum("website",orderName,orderNum))%></a></td>
                    
                    <td class="dg_headerstyle">
                   <a href="javaScript:orderPage('address','<%=OrderTool.getOrderNum("address",orderName,orderNum)%>');">单位地址&nbsp;&nbsp;<%=OrderTool.getOrderImage(basePath,OrderTool.getOrderNum("address",orderName,orderNum))%></a></td>
                    
                    <td class="dg_headerstyle">
                    单位电话
                     </td>
                    
                    <td class="dg_headerstyle">
                    单位传真
                    </td>
                <td class="dg_headerstyle">编辑</td>
                 <td class="dg_headerstyle">删除</td>
            </tr> 
            <% 
             if(list != null && list.size()>0){
              	for(int i = 0;i<list.size();i++){
            	 	Organization organization= (Organization)list.get(i);
            %>
            <tr class="dg_alternatingitemstyle" onmouseover="ChangeRowBg(this);" onmouseout="ChangeRowBg(this);" onmouseup="ChangeRowBg(this);" onmousedown="ChangeRowBg(this);">
               <td align="center" width="5%">
                     <%= perpageCount*(currentPage-1)+i+1 %></td>
                <td>
                    <%=organization.getName() %>
                </td> 
                <td>
                     <%=StringUtilTool.setObjNULLStr(organization.getUnitcode()) %>
                </td>
                <td>
                     <%=StringUtilTool.setObjNULLStr(organization.getWebsite()) %>
                </td>
                <td>
                     <%=StringUtilTool.setObjNULLStr(organization.getAddress()) %>
                </td>
                <td>
                     <%=StringUtilTool.setObjNULLStr(organization.getPhone()) %>
                </td>
                <td>
                     <%=StringUtilTool.setObjNULLStr(organization.getFax()) %>
                </td>
                <td align="center">
                
                <img style="cursor: hand" src="<%=basePath%>index/Themes/com/68design.net_registration1_(edit)_16x16.gif" onclick="javascript:modifyUser('<%=organization.getId() %>');"
                                    alt="编辑" />
                  
                <td align="center">
                
                <img style="cursor: hand" src="<%=basePath%>index/Themes/com/68design.net_registration1_(delete)_16x16.gif" onclick="javascript:changeState('<%=organization.getId() %>');"
               alt="删除" />
                
                </td>
            </tr>
            <%}}else{ %>
             <tr class="dg_alternatingitemstyle" align="right">
                <td colspan="10"><font color="red">没有找到记录</font></td> 
            </tr> 
            <%} %>
        </table>
        <div class="dg_pagerstyle" align="right">
        <%=pageUtil.getPageStr()%>
        </div>
    </div>
  </body>
</html>
